﻿
using HSGD.Model.Models.HSGD_Family;
using HSGDcIS.IServices.HSGD_Family;
using HSGD.Services.BASE;
using HSGD.IRepository.BASE;
using HSGD.Model.Dtos.HSGD_Family;
using AutoMapper;

namespace HSGD.Services.HSGD_Family;
public class ChildServices : BaseServices<Child>, IChildServices {
    private readonly IBaseRepository<Child> _dal;
    private readonly IMapper mapper;

    public ChildServices(IBaseRepository<Child> dal, IMapper _mapper) {
        this._dal = dal;
        base.BaseDal = dal;
        mapper = _mapper;
    }

    public async Task<List<ChildDto>> GetChildAsync() {
        var res = await base.Query();
        var result = mapper.Map<List<ChildDto>>(res);
        return result;
    }
    public async Task<ChildDto> GetChildByIdAsync(int child_id) {
        var res = await base.QueryById(child_id);
        var result = mapper.Map<ChildDto>(res);
        return result;
    }
}